package cn.ywang.current.demo;

import java.util.concurrent.CountDownLatch;

/**
 * @author BeatificWang
 * @date 2019/7/30 22:45
 */
public class CountDownLatchDemo extends Thread {

	private static CountDownLatch downLatch = new CountDownLatch(1);

	@Override
	public void run() {
		try {
			downLatch.await();
			System.out.println("线程：" + Thread.currentThread().getName());
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		for (int i = 0; i < 500; i++) {
			new CountDownLatchDemo().start();
		}
		downLatch.countDown();
	}
}
